<?php
/*
 * Copyright (c) 2008, 2009 Conor McDermottroe
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, 
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice, 
 *    this list of conditions and the following disclaimer in the documentation 
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the author nor the names of any contributors to the 
 *    software may be used to endorse or promote products derived from this 
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */
/* XXX Autogenerated - do not edit XXX*/
/**	@package vBulletinAPI
 *	@filesource
 */

/** Base data class. */
require_once("DataObject.php");

/** Represent a post in a vBulletin system.
 *
 *	@property	int $id 			The ID of the post within vBulletin.
 *	@property	Thread $thread			The thread in which this post resides.
 *	@property	User $author			The author of the post.
 *	@property	DateTime $createTime	The time and date that the post was
 *										created.
 *	@property	string $text			The text of the post, in BBCode format.
 *	@property	string $title			The title of the post, if any.
 *	@property	int $status 		The status of the post
 *	@property	PostEdit $edited		The last edit made to the post, if any.
 *	@property	Icon $icon				An icon for the post
 *	@property	Infraction $infraction	Any infraction given for the post.
 *	@property	Thread $reportThread	The thread created when this post was
 *										reported.
 *	@property	string $ip				The IP address the post was made from.
 *	@package	vBulletinAPI
 */
class Post
extends DataObject
{
	/** The post is invisible. */
	public static $STATUS_INVISIBLE = 1;

	/** The post is deleted. */
	public static $STATUS_DELETED = 2;

	/** The post is deleted. */
	public static $STATUS_HAS_ATTACHMENT = 4;

	/** Create a new {@link Post}.
	 *
	 *	@param	int $id 			The ID of the post within vBulletin.
	 *	@param	Thread $thread			The thread in which this post resides.
	 *	@param	User $author			The author of the post.
	 *	@param	DateTime $createTime	The time and date that the post was
	 *									created.
	 *	@param	string $text			The text of the post, in BBCode format.
	 *	@param	string $title			The title of the post, if any.
	 *	@param	int $status 		The status of the post
	 *	@param	PostEdit $edited		The last edit made to the post, if any.
	 *	@param	Icon $icon				An icon for the post
	 *	@param	Infraction $infraction	Any infraction given for the post.
	 *	@param	Thread $reportThread	The thread created when this post was
	 *									reported.
	 *	@param	string $ip				The IP address the post was made from.
	 */
	public function __construct($id, Thread $thread = NULL, User $author = NULL, DateTime $createTime = NULL, $text = "", $title = "", $status = 0, PostEdit $edited = NULL, Icon $icon = NULL, Infraction $infraction = NULL, Thread $reportThread = NULL, $ip = "") {
		$this->data['id'] = $id;
		$this->type['id'] = "int";
		$this->data['thread'] = $thread;
		$this->type['thread'] = "Thread";
		$this->data['author'] = $author;
		$this->type['author'] = "User";
		$this->data['createTime'] = $createTime;
		$this->type['createTime'] = "DateTime";
		$this->data['text'] = $text;
		$this->type['text'] = "string";
		$this->data['title'] = $title;
		$this->type['title'] = "string";
		$this->data['status'] = $status;
		$this->type['status'] = "int";
		$this->data['edited'] = $edited;
		$this->type['edited'] = "PostEdit";
		$this->data['icon'] = $icon;
		$this->type['icon'] = "Icon";
		$this->data['infraction'] = $infraction;
		$this->type['infraction'] = "Infraction";
		$this->data['reportThread'] = $reportThread;
		$this->type['reportThread'] = "Thread";
		$this->data['ip'] = $ip;
		$this->type['ip'] = "string";
	}

	/** Default values for the properties. These will be used to minimise the 
	 *	data to be sent over the wire.
	 *
	 *	@return	array	Default values for properties which have them.
	 */
	protected function defaultPropertyValues() {
		return array(
			"thread" => NULL,
			"author" => NULL,
			"createTime" => NULL,
			"text" => "",
			"title" => "",
			"status" => 0,
			"edited" => NULL,
			"icon" => NULL,
			"infraction" => NULL,
			"reportThread" => NULL,
			"ip" => "",
		);
	}
	
	/** Get the names of the required constructor parameters in the order in
	 *	which they must appear in the constructor.
	 *
	 *	@return	array	An array containing the names of the properties which
	 *					must appear in order in the constructor parameters.
	 */
	public static function requiredConstructorParams() {
		return array(
			"id",
		);
	}
}
?>
